<?php
/**
 * ============================================================================
 * Doxt Version: 1.0           
 * Web: http:
 * Copyright (C) 2007 - 2010 Doxt Technology Inc., All Rights Reserved.
 * ---------------------------------------------
 * $Date: 2008.4.8
*/

  if ($_POST["btn_sub"])
  {
    include_once("sub_edit_news.php");
	exit(0);
  }
/* 分类列表文件,显示所有的分类 */
  include("list_cate.php");

  $NEWS_ID = intval( $_GET["id"] );
  if (empty($NEWS_ID)) exit(0);

  $query = "SELECT * FROM $TBL_NEWS WHERE id='$NEWS_ID'";
  $result = mysql_query( $query ) or die(mysql_error());
  $rows = mysql_fetch_array( $result);
  if($rows['img']!='')
  {
	$file ='../../upload/news/'.$NEWS_ID."/homeimage/".$rows['img'];
	$img = "<img src='$file' width='100'/><br>";
  } 

  /* 指定模板文件 */
  $tpl -> set_file(array("main" => "edit_news.htm"));  
  $tpl -> set_block("main","TYPE_LIST","type_list");
  //加载FCKeditor编辑器(绝对路径)
  include_once("../../fckeditor/fckeditor.php");
  //中文
  //加载FCKeditor编辑器
  include($conf["base_path"] ."fckeditor/fckeditor.php");
  //中文
  $editor = new FCKeditor('chinese_edit');
  $editor -> BasePath   = "../../fckeditor/";
  $editor -> ToolbarSet = "Normal";
  $editor -> Width      = "100%";
  $editor -> Height     = "500";
  $editor -> Value      = $rows['ch_text'];
  $chinese_edit = $editor->CreateHtml();
  //英文
  $editor2 = new FCKeditor('english_edit') ;
  $editor2->BasePath   = "../../fckeditor/";
  $editor2->ToolbarSet = "Normal";
  $editor2->Width      = "100%";
  $editor2->Height     = "500";
  $editor2 -> Value    = $rows['en_text'];
  $english_edit = $editor2->CreateHtml(); 
  $tpl -> set_var(array(
                         "ch_headline" => $rows['ch_headline'],
						 "en_headline" => $rows['en_headline'],
						 "ch_source" => $rows['ch_source'],
						 "en_source" => $rows['en_source'],
						 "img" => $img,
						 "id"=> $rows['id'],
						 "check".$rows['sorting']=>"checked='checked'",
                         "SHOW_CATE" => $show_cate,
	     				 "CHINESE_EDIT" => $chinese_edit,
						 "ENGLISH_EDIT" => $english_edit,
						 "NEWS_ID" => $NEWS_ID,
						 "init_cate" => $init_cate,
						 "date_added" => $rows['date_added'],	
						 "pics" => $pics,						 					

                       ));
  $tpl -> set_var( $conf);
  $tpl -> parse("Output", "main");
  $tpl -> p("Output");
  exit(0);
?>